from selenium import webdriver
from selenium.webdriver import ActionChains, Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By


path = Service(executable_path=r'C:\Users\Laptop\Desktop\thirty_one\chromedriver.exe')
driver = webdriver.Chrome(service=path)
driver.maximize_window()
driver.implicitly_wait(10)
'''键盘操作'''
# 使用Keys这个类来模拟键盘的操作，输入的话使用send_keys()即可

driver.get('https://baidu.com')

input_value = driver.find_element(By.NAME, 'wd')
input_value.send_keys('第一次输入的内容')
input_value.click()
input_value.send_keys(Keys.CONTROL, 'a') # 全选
a = input_value.send_keys(Keys.CONTROL, 'c') # 复制
print(a)

# Keys.CONTROL,'x' # 剪切
# Keys.CONTROL,'z' # 撤回
# Keys.BACK_SPACE # 回退
# Keys.SPACE # 空格
# Keys.TAB # 制表符

